<?php
/**
 * Created by PhpStorm.
 * User: alei
 * Date: 11/11/2017 AD
 * Time: 14:42
 */
namespace App\Models\Mysql;

//use Illuminate\Database\Eloquent\Model;
use App\Models\Traits\BaseDBMethod;

class pre_forum_forum
{
	use BaseDBMethod;
	//数据库连接配置项，见config/database.php
	const DATABASE_CONF = 'lqyw_mysql';
	//pre_ct_ui 首页轮播图所在表
	const TABLE_NAME = 'pre_forum_forum';

	//数据库连接配置项，见config/database.php
	//如果需要用ORM，需要设置此项
//	protected $connection = self::DATABASE_CONF;
	//表名，如果需要用ORM，需要设置此项
//	protected $table = self::TABLE_NAME;

	public static function getFIDbyName($name)
	{
		if(is_string($name)) $name = [$name];
		return self::getDBobj()
			->select(['fid','name'])
			->whereIn('name', $name)
			->get();
	}

	public static function getBoardInfoByForumID($forumID)
	{
		if( ! $forumID ) return [];
		return self::getDBobj(TRUE)
			->select('fid as boardId', 'name as boardName')
			->where('fup', $forumID)
			->get();
	}
} //end pre_forum_forum
